<?php 
$sql =	"SELECT
			  c.page_id,
	
			  d.title,
			  d.description,
			  d.meta_key,
			  d.meta_description	
		  FROM
			  pages AS c,
			  page_description AS d
		  WHERE
		  
			  c.page_id = d.page_id
			  AND
			  d.lang_id = '".$_SESSION['lang_id']."'
			  AND
			  c.sef_url = 'news' 
			  
		  ";
$result = query($sql);
$row = mysql_fetch_object($result);

if($_GET["frompage"]) $page = " - страница ". (($_GET["frompage"]/10) +1);
head(sth($row->title).$page,sth($row->meta_key),sth($row->meta_description));

?>

<div id="wrap">

	<div id="topicons">
		<a class="icon home" href="<?=HTML_BASE?>"><span><?=__HOME?></span></a>
		<a class="icon about" href="<?=HTML_BASE.$_SESSION['lang']?>/about"><span><?=__ABOUT?></span></a>
		
		
	</div>
	<div id="lefticons">
		
		<a class="icon contacts" href="<?=HTML_BASE.$_SESSION['lang']?>/contacts"><span><?=__CONTACTS?></span></a>
        
        <a class="icon fearless" href="http://www.fearlessphotographers.com/"><span><?=__MEMBER_OF?></span></a>
		
	</div>
    
    
	
		<div id="pagecontent">
		<!--<div id="contentimg">
			
		</div>-->
		<div id="contenttextfull">
			 <?=stripslashes($row->description)?>
             
             
             <?php
            	require '../include/frontpaging.inc.php';
				$sql = "SELECT
				c.sef_url,
				c.new_id,
				c.creation_time,
				
				d.title,
				d.description
				
			FROM
				news AS c,
				news_description AS d
			WHERE
				c.new_id = d.new_id
				AND
				d.lang_id = '".$_SESSION['lang_id']."'
				AND c.published
				
			  ";
			  if (!isset($_GET['sort'])) $_GET['sort'] = 1;
			  if (!isset($_GET['sortBy'])) $_GET['sortBy'] = 2;
	
				$paging = new Paging($sql, $_GET['sortBy'], $_GET['sort'], array(2=>"Подредба"), 10);
				$result = $paging->query();
			
			   while ($row = mysql_fetch_object($result)) {
			?>
            
			<div class="new">
				<div class="title"><a href="<?=HTML_BASE.$_SESSION['lang']?>/news/<?=$row->sef_url?>"><?=$row->title?></a></div>
				<div class="date"><?=date('d.m.Y', strtotime($row->creation_time))?></div>
				<div class="content">
			<p><?=text_format(stripslashes($row->description), 200)?>...</p>
				</div>
				<a class="readmore" href="<?=HTML_BASE.$_SESSION['lang']?>/news/<?=$row->sef_url?>"><?=__READMORE?> &raquo;</a>
			</div>
			<?php }?>
				<div class="pagingwrap">
                    <div class="paging">
                    	<?=$paging->display()?>
                    </div>
                </div>
            </div>    
             
             
             
		</div>
	</div>
   
	
<?php

foot();
?>